
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class OleDbEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace Alserve.Ffl.Data
{
	public abstract class _UserPoints : OleDbEntity
	{
		public _UserPoints()
		{
			this.QuerySource = "UserPoints";
			this.MappingName = "UserPoints";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override string GetAutoKeyColumn()
		{
			return "Id";
		}

		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UserPointsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int Id)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.Id, Id);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UserPointsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static OleDbParameter Id
			{
				get
				{
					return new OleDbParameter("@Id", OleDbType.Numeric, 0);
				}
			}
			
			public static OleDbParameter UserId
			{
				get
				{
					return new OleDbParameter("@UserId", OleDbType.Numeric, 0);
				}
			}
			
			public static OleDbParameter TotalPoints
			{
				get
				{
					return new OleDbParameter("@TotalPoints", OleDbType.Numeric, 0);
				}
			}
			
			public static OleDbParameter ThisMonthPoints
			{
				get
				{
					return new OleDbParameter("@ThisMonthPoints", OleDbType.Numeric, 0);
				}
			}
			
			public static OleDbParameter LastMonthPoints
			{
				get
				{
					return new OleDbParameter("@LastMonthPoints", OleDbType.Numeric, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string Id = "Id";
            public const string UserId = "UserId";
            public const string TotalPoints = "TotalPoints";
            public const string ThisMonthPoints = "ThisMonthPoints";
            public const string LastMonthPoints = "LastMonthPoints";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id] = _UserPoints.PropertyNames.Id;
					ht[UserId] = _UserPoints.PropertyNames.UserId;
					ht[TotalPoints] = _UserPoints.PropertyNames.TotalPoints;
					ht[ThisMonthPoints] = _UserPoints.PropertyNames.ThisMonthPoints;
					ht[LastMonthPoints] = _UserPoints.PropertyNames.LastMonthPoints;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string Id = "Id";
            public const string UserId = "UserId";
            public const string TotalPoints = "TotalPoints";
            public const string ThisMonthPoints = "ThisMonthPoints";
            public const string LastMonthPoints = "LastMonthPoints";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id] = _UserPoints.ColumnNames.Id;
					ht[UserId] = _UserPoints.ColumnNames.UserId;
					ht[TotalPoints] = _UserPoints.ColumnNames.TotalPoints;
					ht[ThisMonthPoints] = _UserPoints.ColumnNames.ThisMonthPoints;
					ht[LastMonthPoints] = _UserPoints.ColumnNames.LastMonthPoints;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string Id = "s_Id";
            public const string UserId = "s_UserId";
            public const string TotalPoints = "s_TotalPoints";
            public const string ThisMonthPoints = "s_ThisMonthPoints";
            public const string LastMonthPoints = "s_LastMonthPoints";

		}
		#endregion		
		
		#region Properties
	
		public virtual int Id
	    {
			get
	        {
				return base.Getint(ColumnNames.Id);
			}
			set
	        {
				base.Setint(ColumnNames.Id, value);
			}
		}

		public virtual int UserId
	    {
			get
	        {
				return base.Getint(ColumnNames.UserId);
			}
			set
	        {
				base.Setint(ColumnNames.UserId, value);
			}
		}

		public virtual int TotalPoints
	    {
			get
	        {
				return base.Getint(ColumnNames.TotalPoints);
			}
			set
	        {
				base.Setint(ColumnNames.TotalPoints, value);
			}
		}

		public virtual int ThisMonthPoints
	    {
			get
	        {
				return base.Getint(ColumnNames.ThisMonthPoints);
			}
			set
	        {
				base.Setint(ColumnNames.ThisMonthPoints, value);
			}
		}

		public virtual int LastMonthPoints
	    {
			get
	        {
				return base.Getint(ColumnNames.LastMonthPoints);
			}
			set
	        {
				base.Setint(ColumnNames.LastMonthPoints, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_Id
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Id) ? string.Empty : base.GetintAsString(ColumnNames.Id);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Id);
				else
					this.Id = base.SetintAsString(ColumnNames.Id, value);
			}
		}

		public virtual string s_UserId
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.UserId) ? string.Empty : base.GetintAsString(ColumnNames.UserId);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.UserId);
				else
					this.UserId = base.SetintAsString(ColumnNames.UserId, value);
			}
		}

		public virtual string s_TotalPoints
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.TotalPoints) ? string.Empty : base.GetintAsString(ColumnNames.TotalPoints);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.TotalPoints);
				else
					this.TotalPoints = base.SetintAsString(ColumnNames.TotalPoints, value);
			}
		}

		public virtual string s_ThisMonthPoints
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ThisMonthPoints) ? string.Empty : base.GetintAsString(ColumnNames.ThisMonthPoints);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ThisMonthPoints);
				else
					this.ThisMonthPoints = base.SetintAsString(ColumnNames.ThisMonthPoints, value);
			}
		}

		public virtual string s_LastMonthPoints
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastMonthPoints) ? string.Empty : base.GetintAsString(ColumnNames.LastMonthPoints);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastMonthPoints);
				else
					this.LastMonthPoints = base.SetintAsString(ColumnNames.LastMonthPoints, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter Id
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Id, Parameters.Id);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter UserId
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.UserId, Parameters.UserId);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter TotalPoints
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.TotalPoints, Parameters.TotalPoints);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ThisMonthPoints
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ThisMonthPoints, Parameters.ThisMonthPoints);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastMonthPoints
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastMonthPoints, Parameters.LastMonthPoints);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter Id
		    {
				get
		        {
					if(_Id_W == null)
	        	    {
						_Id_W = TearOff.Id;
					}
					return _Id_W;
				}
			}

			public WhereParameter UserId
		    {
				get
		        {
					if(_UserId_W == null)
	        	    {
						_UserId_W = TearOff.UserId;
					}
					return _UserId_W;
				}
			}

			public WhereParameter TotalPoints
		    {
				get
		        {
					if(_TotalPoints_W == null)
	        	    {
						_TotalPoints_W = TearOff.TotalPoints;
					}
					return _TotalPoints_W;
				}
			}

			public WhereParameter ThisMonthPoints
		    {
				get
		        {
					if(_ThisMonthPoints_W == null)
	        	    {
						_ThisMonthPoints_W = TearOff.ThisMonthPoints;
					}
					return _ThisMonthPoints_W;
				}
			}

			public WhereParameter LastMonthPoints
		    {
				get
		        {
					if(_LastMonthPoints_W == null)
	        	    {
						_LastMonthPoints_W = TearOff.LastMonthPoints;
					}
					return _LastMonthPoints_W;
				}
			}

			private WhereParameter _Id_W = null;
			private WhereParameter _UserId_W = null;
			private WhereParameter _TotalPoints_W = null;
			private WhereParameter _ThisMonthPoints_W = null;
			private WhereParameter _LastMonthPoints_W = null;

			public void WhereClauseReset()
			{
				_Id_W = null;
				_UserId_W = null;
				_TotalPoints_W = null;
				_ThisMonthPoints_W = null;
				_LastMonthPoints_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter Id
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Id, Parameters.Id);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter UserId
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.UserId, Parameters.UserId);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter TotalPoints
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.TotalPoints, Parameters.TotalPoints);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ThisMonthPoints
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ThisMonthPoints, Parameters.ThisMonthPoints);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastMonthPoints
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastMonthPoints, Parameters.LastMonthPoints);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter Id
		    {
				get
		        {
					if(_Id_W == null)
	        	    {
						_Id_W = TearOff.Id;
					}
					return _Id_W;
				}
			}

			public AggregateParameter UserId
		    {
				get
		        {
					if(_UserId_W == null)
	        	    {
						_UserId_W = TearOff.UserId;
					}
					return _UserId_W;
				}
			}

			public AggregateParameter TotalPoints
		    {
				get
		        {
					if(_TotalPoints_W == null)
	        	    {
						_TotalPoints_W = TearOff.TotalPoints;
					}
					return _TotalPoints_W;
				}
			}

			public AggregateParameter ThisMonthPoints
		    {
				get
		        {
					if(_ThisMonthPoints_W == null)
	        	    {
						_ThisMonthPoints_W = TearOff.ThisMonthPoints;
					}
					return _ThisMonthPoints_W;
				}
			}

			public AggregateParameter LastMonthPoints
		    {
				get
		        {
					if(_LastMonthPoints_W == null)
	        	    {
						_LastMonthPoints_W = TearOff.LastMonthPoints;
					}
					return _LastMonthPoints_W;
				}
			}

			private AggregateParameter _Id_W = null;
			private AggregateParameter _UserId_W = null;
			private AggregateParameter _TotalPoints_W = null;
			private AggregateParameter _ThisMonthPoints_W = null;
			private AggregateParameter _LastMonthPoints_W = null;

			public void AggregateClauseReset()
			{
				_Id_W = null;
				_UserId_W = null;
				_TotalPoints_W = null;
				_ThisMonthPoints_W = null;
				_LastMonthPoints_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UserPointsInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UserPointsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UserPointsDelete]";
	
			OleDbParameter p;
			p = cmd.Parameters.Add(Parameters.Id);
			p.SourceColumn = ColumnNames.Id;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(OleDbCommand cmd)
		{
			OleDbParameter p;
		
			p = cmd.Parameters.Add(Parameters.Id);
			p.SourceColumn = ColumnNames.Id;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.UserId);
			p.SourceColumn = ColumnNames.UserId;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.TotalPoints);
			p.SourceColumn = ColumnNames.TotalPoints;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ThisMonthPoints);
			p.SourceColumn = ColumnNames.ThisMonthPoints;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastMonthPoints);
			p.SourceColumn = ColumnNames.LastMonthPoints;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
